Fix dependency group id.
[cyberduck.git] / Spotlight Importer / GetMetadataForFile.m
blob6b311fec1b6b9789b9f352985b4b1605fa49f6c1
1 /*
2  *  Copyright (c) 2005 David Kocher. All rights reserved.
3  *  http://cyberduck.ch/
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  Bug fixes, suggestions and comments should be sent to:
16  *  dkocher@cyberduck.ch
17  */
19 #include <CoreFoundation/CoreFoundation.h>
20 #include <CoreServices/CoreServices.h> 
22 #import <Cocoa/Cocoa.h>
24 Boolean GetMetadataForFile(void* thisInterface, 
25                                                    CFMutableDictionaryRef attributes, 
26                                                    CFStringRef contentTypeUTI,
27                                                    CFStringRef file)
29     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
30     NSDictionary *bookmark = [NSDictionary dictionaryWithContentsOfFile:(NSString *)file];
31         if(bookmark) 
32         {
33                 if(nil != [bookmark objectForKey:@"Hostname"]) {
34                         [(NSMutableDictionary *)attributes setObject:[bookmark objectForKey:@"Hostname"]
35                                                                                                   forKey:@"ch_sudo_cyberduck_hostname"];
36                 }
37                 if(nil != [bookmark objectForKey:@"Nickname"]) {
38                         [(NSMutableDictionary *)attributes setObject:[bookmark objectForKey:@"Nickname"]
39                                                                                                   forKey:@"ch_sudo_cyberduck_nickname"];
40                 }
41         }
42         [pool drain];
43         
44     return TRUE;